<template>
	<view class="">
		<view class="cha" @click="backFn">
			<image class="cha-img" src="../../static/images/cha.png" mode=""></image>
		</view>
		<view class="face-text">
			拿起手机，眨眨眼
		</view>
		<view class="">
			 <camera device-position="back" flash="off" @error="error" style="width: 100%; height: 300px;"></camera>
		</view>

		


	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
import {
		ref,
		reactive,
		onMounted
	} from 'vue'
	const backFn = () => {
		uni.navigateBack(-1)
	}
	// onMounted(()=>{
	// 	takePhoto()
	// })
	onLoad(()=>{
			takePhoto()
	})
	const src=ref('')

	 const takePhoto=()=> {
	            const ctx = uni.createCameraContext();
	            ctx.takePhoto({
	                quality: 'high',
	                success: (res) => {
	                    src.value = res.tempImagePath
	                }
	            });
	        }
	        const error=(e)=> {
	            console.log(e.detail);
	        }
	
	
</script>

<style scoped lang="scss">
	.cha {
		position: fixed;
		top: 100rpx;
		left: 40rpx;

		.cha-img {
			width: 40rpx;
			height: 40rpx;
		}
	}

	.face-text {
		font-size: 40rpx;
		font-weight: bolder;
		margin-top: 250rpx;
		text-align: center;
	}



	
</style>